﻿@model MVC.Models.EscolhaPrato

@{
    ViewBag.Title = "EscolherPratos";
    var dia = ViewData["Dia"];
    int crianca= ViewBag.Crianca;
    string nome= ViewBag.Nome;
    DateTime primeiroDia = ViewBag.Dia;

    while (primeiroDia.DayOfWeek != DayOfWeek.Monday)
    {
        primeiroDia = primeiroDia.AddDays(-1);
    }
        
}

<h2>EscolherPratos</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Escolha de Prato</legend>
           
        <div class="editor-label">
           Crianca
        </div>     

        <div class="editor-field">
           @Html.Label("nome",nome)           
        </div>
                

         <div class="editor-label">
            @Html.LabelFor(model => model.DiaEscolar.Dia)
        </div>
        <div class="editor-field">
            @Html.LabelFor(model => model.DiaEscolar.Dia.DayOfWeek, ViewData["Dia"].ToString())           
        </div>

        <div class="editor-label">
           Prato
        </div>     

        <div class="editor-field">
           @Html.DropDownListFor(model => model.Prato.NomePrato, (IEnumerable<SelectListItem>)ViewData["Pratos"])            
        </div>
               
                
        <div class="editor-field">
           <input type=hidden id="diaEscolar" name="diaEscolar" value=dia />           
        </div>

       @Html.Hidden("criancaId",crianca)
               
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
   @Html.ActionLink("Back", "Ementa", new { diaSemana = primeiroDia, criancaId = ViewBag.Crianca })
</div>
